import { pubRequire } from '@utils/public'
const baseUrl = '/channels'
/* 频道设置获取列表 */
export function getSearchList(obj, callbBack, errBack) {
  return pubRequire('get', `${baseUrl}`, obj, callbBack, errBack)
}
// 根据id获取频道设置详情
export function getEditSetting(id, callBack, errBack) {
  return pubRequire('get', `${baseUrl}/${id}`, '', callBack, errBack)
}
/*添加频道设置表单提交*/
export function putAddSetting(obj, callbBack, errBack) {
  return pubRequire('post', `${baseUrl}`, obj, callbBack, errBack)
}
/*编辑频道设置表单提交*/
export function putEditSetting(id, obj, callbBack, errBack) {
  return pubRequire('put', `${baseUrl}/${id}`, obj, callbBack, errBack)
}
/* 子频道设置获取列表 */
export function getLifeList(id, obj, callbBack, errBack) {
  return pubRequire('get', `${baseUrl}/${id}/children`, obj, callbBack, errBack)
}
/*排序表单提交*/
export function sortContTag(id, cId, obj, callbBack, errBack) {
  return pubRequire(
    'put',
    `${baseUrl}/${id}/children/${cId}/sort`,
    obj,
    callbBack,
    errBack
  )
}
/* 停用 */
export function disable(id, cId, callbBack, errBack) {
  return pubRequire(
    'put',
    `${baseUrl}/${id}/children/${cId}/disable`,
    '',
    callbBack,
    errBack
  )
}
/* 启用 */
export function enable(id, cId, callbBack, errBack) {
  return pubRequire(
    'put',
    `${baseUrl}/${id}/children/${cId}/enable`,
    '',
    callbBack,
    errBack
  )
}
/* 删除 */
export function delAPI(id, cId, params, callbBack, errBack) {
  return pubRequire(
    'delete',
    `${baseUrl}/${id}/children/${cId}`,
    params,
    callbBack,
    errBack
  )
}
/* 恢复 */
export function recovers(id, cId, callbBack, errBack) {
  return pubRequire(
    'put',
    `${baseUrl}/${id}/children/${cId}/recovery`,
    '',
    callbBack,
    errBack
  )
}
/*子频道编辑时获取详情*/
export function getForm(id, cId, callbBack, errBack) {
  return pubRequire(
    'get',
    `${baseUrl}/${id}/children/${cId}`,
    '',
    callbBack,
    errBack
  )
}
/*子频道新增表单提交*/
export function addContTag(id, obj, callbBack, errBack) {
  return pubRequire(
    'post',
    `${baseUrl}/${id}/children`,
    obj,
    callbBack,
    errBack
  )
}
/*子频道编辑表单提交*/
export function editContTag(id, cId, obj, callbBack, errBack) {
  return pubRequire(
    'put',
    `${baseUrl}/${id}/children/${cId}`,
    obj,
    callbBack,
    errBack
  )
}
